package guda.house.biz.form.rule;

import guda.house.biz.util.PriceUtil;
import guda.house.dal.dataobject.ElecRuleDO;

/**
 * Created by well on 15/11/11.
 */
public class ElecRuleEditForm extends ElecRuleForm{

    private Long ruleId;

    public Long getRuleId() {
        return ruleId;
    }

    public void setRuleId(Long ruleId) {
        this.ruleId = ruleId;
    }

    public void initForm(ElecRuleDO elecRuleDO){
        setRuleId(elecRuleDO.getRuleId());
        setMaxValue(elecRuleDO.getMaxValue());
        setRuleName(elecRuleDO.getRuleName());
        setRuleStatus(elecRuleDO.getRuleStatus());
        setMinValue(elecRuleDO.getMinValue());
        setFeeUnit(PriceUtil.formatCNY(elecRuleDO.getFeeUnit()));
        setVillageId(elecRuleDO.getVillageId());
        setBuildingTypeId(elecRuleDO.getBuildingTypeId());

    }

    public ElecRuleDO toDO(){
        ElecRuleDO elecRuleDO = super.toDO();
        elecRuleDO.setRuleId(ruleId);
        return elecRuleDO;
    }
}
